const {fs, path} = require('@vuepress/shared-utils')

module.exports = {
  base: "/leetcode/",
  title: 'Leetcode',
  description: '💖Complete solutions to Leetcode problems; updated daily.',
  host: 'localhost',
  port: '9999',
  head: [
    ['link', {rel: 'icon', href: `/Leetcode.svg`}],
    ['link', {rel: 'manifest', href: '/icons/manifest.json'}],
    ['meta', {name: 'theme-color', content: '#ffffff'}],
    ['meta', {name: 'apple-mobile-web-app-capable', content: 'yes'}],
    ['meta', {name: 'apple-mobile-web-app-status-bar-style', content: 'black'}],
    ['link', {rel: 'apple-touch-icon', href: `/icons/apple-touch-icon.png`}],
    ['link', {rel: 'mask-icon', href: '/icons/safari-pinned-tab.svg', color: '#5bbad5'}],
    ['meta', {name: 'msapplication-TileImage', content: '/icons/mstile-144x144.png'}],
    ['meta', {name: 'msapplication-TileColor', content: '#00aba9'}]
  ],
  theme: '@vuepress/vue',
  themeConfig: {
    repo: 'ryanjiena/Leetcode',
    docsDir: 'docs',
    editLinks: true,
    editLinkText: 'Edit this page on GitHub',
    smoothScroll: true,
    lastUpdated: 'Last Updated',
    nav: [
      {text: 'Index', link: '/'},
      {text: 'Easy', link: '/easy/'},
      {text: 'Medium', link: '/medium/'},
      {text: 'Hard', link: '/hard/'},
      {text: 'Blog', link: 'https://ryanjie.gitee.io'},
      {text: 'Gitee', link: 'https://gitee.com/ryanjiena/Leetcode'}
    ],
    algolia: {
      apiKey: '609a86c98671a264b774c41c67873899',
      indexName: 'bimg'
    },
    sidebar: {
      '/easy/': getEasySidebar('Easy'),
      '/medium/': getMediumSidebar('Medium'),
      '/hard/': getHardSidebar('Hard')
    }
  },
  plugins: [
    ['@vuepress/active-header-links', {
      sidebarLinkSelector: '.sidebar-link',
      headerAnchorSelector: '.header-anchor'
    }],
    ['@vuepress/back-to-top', true],
    ['@vuepress/last-updated'],
    ['@vuepress/medium-zoom', true],
    ['@vuepress/nprogress'],
    ['@vuepress/pwa', {
      serviceWorker: true,
      updatePopup: true
    }],
    ['@vuepress/search', {
      searchMaxSuggestions: 20
    }],
    ['sitemap', {
      hostname: 'https://ryanjiena.gitee.io/leetcode'
    }],
    ['img-lazy'],
    ['vuepress-plugin-code-copy', true]
  ]
}

function getEasySidebar(groupA) {
  return [
    {
      title: groupA,
      collapsable: true,
      sidebarDepth: 2,
      children: [
        '0001-Two-Sum(Easy)',
        '0007-Reverse-Integer(Easy)',
        '0009-Palindrome-Number(Easy)',
        '0013-Roman-to-Integer(Easy)',
        '0014-Longest-Common-Prefix(Easy)',
        '0020-Valid-Parentheses(Easy)',
        '0021-Merge-Two-Sorted-Lists(Easy)',
        '0026-Remove-Duplicates-from-Sorted-Array(Easy)',
        '0027-Remove-Element(Easy)',
        '0028-Implement-strStr()(Easy)',
        '0035-Search-Insert-Position(Easy)',
        '0038-Count-and-Say(Easy)',
        '0053-Maximum-Subarray(Easy)',
        '0058-Length-of-Last-Word(Easy)',
        '0066-Plus-One(Easy)',
        '0067-Add-Binary(Easy)',
        '0069-Sqrt(x)(Easy)',
        '0070-Climbing-Stairs(Easy)'
      ]
    }
  ]
}

function getMediumSidebar(groupB) {
  return [
    {
      title: groupB,
      collapsable: true,
      sidebarDepth: 2,
      children: [
        '0002-Add-Two-Numbers(Medium)',
        '0003-Longest-Substring-Without-Repeating-Characters(Medium)',
        '0005-Longest-Palindromic-Substring(Medium)',
        '0006-ZigZag-Conversion(Medium)',
        '0008-String-to-Integer(atoi)(Medium)',
        '0011-Container-With-Most-Water(Medium)',
        '0012-Integer-to-Roman(Medium)',
        '0015-3Sum(Medium)',
        '0016-3Sum-Closest(Medium)',
        '0017-Letter-Combinations-of-a-Phone-Number(Medium)',
        '0018-4Sum(Medium)',
        '0019-Remove-Nth-Node-From-End-of-List(Medium)',
        '0022-Generate-Parentheses(Medium)',
        '0024-Swap-Nodes-in-Pairs(Medium)',
        '0029-Divide-Two-Integers(Medium)',
        '0033-Search-in-Rotated-Sorted-Array(Medium)',
        '0034-Find-First-and-Last-Position-of-Element-in-Sorted-Array(Medium)',
        '0036-Valid-Sudoku(Medium)',
        '0039-Combination-Sum(Medium)',
        '0040-Combination-Sum-II(Medium)',
        '0043-Multiply-Strings(Medium)',
        '0046-Permutations(Medium)',
        '0047-Permutations-II(Medium)',
        '0048-Rotate-Image(Medium)',
        '0049-Group-Anagrams(Medium)',
        '0050-Pow(x, n)(Medium)',
        '0054-Spiral-Matrix(Medium)',
        '0055-Jump-Game(Medium)',
        '0056-Merge-Intervals(Medium)',
        '0059-Spiral-Matrix-II(Medium)',
        '0060-Permutation-Sequence(Medium)',
        '0061-Rotate-List(Medium)',
        '0062-Unique-Paths(Medium)',
        '0063-Unique-Paths-II(Medium)',
        '0064-Minimum-Path-Sum(Medium)',
        '0071-Simplify-Path(Medium)'
      ]
    }
  ]
}

function getHardSidebar(groupC) {
  return [
    {
      title: groupC,
      collapsable: true,
      sidebarDepth: 2,
      children: [
        '0004-Median-of-Two-Sorted-Arrays(Hard)',
        '0010-Regular-ExpressionMatching(Hard)',
        '0023-Merge-k-Sorted-Lists(Hard)',
        '0025-Reverse-Nodes-in-k-Group(Hard)',
        '0030-Substring-with-Concatenation-of-All-Words(Hard)',
        '0031-Next-Permutation(Medium)',
        '0032-Longest-Valid-Parentheses(Hard)',
        '0037-Sudoku-Solver(Hard)',
        '0041-First-Missing-Positive(Hard)',
        '0042-Trapping-Rain-Water(Hard)',
        '0044-Wildcard-Matching(Hard)',
        '0045-Jump-Game-II(Hard)',
        '0051-N-Queens(Hard)',
        '0052-N-Queens-II(Hard)',
        '0057-Insert-Interval(Hard)',
        '0065-Valid-Number(Hard)',
        '0068-Text-Justification(Hard)',
        '0072-Edit-Distance(Hard)'
      ]
    }
  ]
}
